package ru.amse.baltijsky.javascheme.exporter.stream;

import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;

public class StreamExporterFactory implements IStreamExporterFactory {
    public IStreamExporter createExporter(String alias) throws IOException {
        if (alias.equalsIgnoreCase("Text")) {
            return new TextExporter();
        } else if (alias.equalsIgnoreCase("XMI")) {
            try {
                return new XmiExporter();
            } catch (ParserConfigurationException e) {
                throw new IOException(e);
            }
        } else if (alias.equalsIgnoreCase("DOT")) {
            return new DotExporter();
        }
        throw new IOException("Unknown exporter alias (" + alias + ")");
    }
}
